package com.surfilter.platform.base.model;

import java.lang.reflect.Method;
import java.util.Map;

public class MethodWrap {

	private Method method;
	private PermissionMethodType type;
	private String actionName;
	private String[] refActions;
	private Class belongTo;

	private Map<Integer, ParameterInfoModel> paramInfos;

	public MethodWrap(String wname, Method wMethod, PermissionMethodType wtype,
			String[] refActions) {
		this.actionName = wname;
		this.method = wMethod;
		this.type = wtype;
		this.refActions = refActions;
	}

	/**
	 * @param method
	 * @param type
	 * @param actionName
	 * @param refActions
	 * @param belongTo
	 */
	public MethodWrap(Method method, String actionName, PermissionMethodType type,
			String[] refActions, Class belongTo) {
		super();
		this.method = method;
		this.type = type;
		this.actionName = actionName;
		this.refActions = refActions;
		this.belongTo = belongTo;
	}



	public String getActionName() {
		return actionName;
	}

	public Method getMethod() {
		return method;
	}

	public PermissionMethodType getType() {
		return type;
	}

	public String[] getRefActions() {
		return refActions;
	}

	public void setParamInfos(Map<Integer, ParameterInfoModel> infos) {
		this.paramInfos = infos;
	}

	public ParameterInfoModel getParameterMapInfo(int index) {
		if (paramInfos == null)
			return null;
		return paramInfos.get(index);
	}
	
	/**
	 * @return the belongTo
	 */
	public Class getBelongTo() {
		return belongTo;
	}

	/**
	 * @param belongTo the belongTo to set
	 */
	public void setBelongTo(Class belongTo) {
		this.belongTo = belongTo;
	}
}
